﻿namespace MassIntellect.WorkIt.Frames
{
    public abstract class ServiceDependedFrame<T>: WorkFrame, IServiceLocatorDepend
        where T :class
    {
        protected T Service;

        protected T GetService()
        {
            return Service ?? (Service = ServiceLocator.Resolve<T>());
        }

        private IServiceLocator _ServiceLocator;
        public virtual IServiceLocator ServiceLocator
        {
            get { return _ServiceLocator ?? WorkIt.ServiceLocator.NoService; }
            set { _ServiceLocator = value; }
        }
    }
}
